package cn.pfz.Service.impl;

import cn.pfz.Service.ISystemDictionarySerives;
import cn.pfz.domain.Role;
import cn.pfz.domain.SystemDictionary;
import cn.pfz.mapper.SystemDictionaryMapper;
import cn.pfz.query.QueryObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ISystemDictionarySerivesimpl implements ISystemDictionarySerives {
    @Autowired
    private SystemDictionaryMapper systemDictionaryMapper;
    @Override
    public int deleteByPrimaryKey(Long id) {
        return systemDictionaryMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(SystemDictionary record) {
        return systemDictionaryMapper.insert(record);
    }

    @Override
    public SystemDictionary selectByPrimaryKey(Long id) {
        return systemDictionaryMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<SystemDictionary> selectAll() {
        return systemDictionaryMapper.selectAll();
    }

    @Override
    public int updateByPrimaryKey(SystemDictionary record) {
        return systemDictionaryMapper.updateByPrimaryKey(record);
    }

    @Override
    public PageInfo<SystemDictionary> list(QueryObject qo) {
        //通过pageHelper进行设置分页及排序
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize(),"id asc");
        //在Sql中不需要limit
        List<SystemDictionary> list = systemDictionaryMapper.selectRusult(qo);
        PageInfo<SystemDictionary> PageInfo = new PageInfo(list);
        return PageInfo;
    }
}
